home *** CD-ROM | disk | FTP | other *** search
/ NeXT Education Software Sampler 1992 Fall / NeXT Education Software Sampler 1992 Fall.iso / Programming / Source / tess / tess-1.0 / p6.m < prev    next >
Encoding:
Text File  |  1992-06-30  |  956 b   |  52 lines

  1. #import "p6.h"
  2.  
  3. @implementation p6
  4. - resizeGenerator
  5. {
  6.   latticesize.height = 8.0/3.0 * bounds.size.height;
  7.   latticesize.width = bounds.size.width * 2.0;
  8.   upx = bounds.size.width;
  9.   upy = 2.0 * bounds.size.height;
  10.   overx = latticesize.width;
  11.   return self;
  12. }
  13.  
  14. - clip: (NXCoord) x: (NXCoord) y 
  15.   PSnewpath();
  16.   PSmoveto(x,y);
  17.   PSrlineto(bounds.size.width,0);
  18.   PSrlineto(0,latticesize.height/4.0);
  19.   PSrlineto(-[self equi: latticesize.height/4.0],latticesize.height/8.0);
  20.   PSclosepath();
  21.   PSclip();
  22.   return self;
  23. }
  24.  
  25. - makeLatticeUnitAt: (NXPoint *) point fromImage: srcimg 
  26. {
  27.   id imgrep;
  28.   int i;
  29.   NXPoint pt;
  30.   
  31.   pt.x = - point->x ;
  32.   pt.y = - point->y ;
  33.   imgrep = [srcimg bestRepresentation];
  34.   for(i=0;i<6;i++){
  35.     PSgsave();
  36.     PSrotate(60*i);
  37.     [self clip:0.0:0.0];
  38.     [imgrep drawAt: &pt];
  39.     PSgrestore();
  40.   }
  41.   return self;
  42. }
  43. - sizeKludge: (float *) x : (float *) y
  44. {
  45.   float hyp;
  46.  
  47.   *y = [self equi: *x];
  48.   return self;
  49. }
  50. @end
  51.